import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

/**
 * Files.readAllLines
 */
public class FilesReadAllLinesTest {
    public static void main(String[] args) {
        String fileName = "src/main/resources/static/TestReaderFile.txt";
        // 转换成List<String>, 要注意java.lang.OutOfMemoryError: Java heap space
        List<String> lines = null;
        try {
            lines = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
            lines.forEach(System.out::println);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
